MaxSort in Java